//
//  HXTabBarController.h
//  RomensSDK
//
//  Created by 王增战 on 2017/3/29.
//  Copyright © 2017年 孙博. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface HXTabBarController : UITabBarController

// 统计未读消息数
//-(void)setupUnreadMessageCount;

@end

/*
 //接收到本地通知后，执行的操作，建议放到自定义的TabBarController里面。
 - (void)didReceiveLocalNotification:(UILocalNotification *)notification
 {
 NSDictionary *userInfo = notification.userInfo;
 if (userInfo)
 {
 if ([self.navigationController.topViewController isKindOfClass:[ChatViewController class]]) {
 
 
 }
 
 NSArray *viewControllers = self.navigationController.viewControllers;
 [viewControllers enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop){
 if (obj != self)
 {
 if (![obj isKindOfClass:[ChatViewController class]])
 {
 [self.navigationController popViewControllerAnimated:NO];
 }
 else
 {
 NSString *conversationChatter = userInfo[kConversationChatter];
 ChatViewController *chatViewController = (ChatViewController *)obj;
 if (![chatViewController.conversation.conversationId isEqualToString:conversationChatter])
 {
 [self.navigationController popViewControllerAnimated:NO];
 EMChatType messageType = [userInfo[kMessageType] intValue];
 chatViewController = [[ChatViewController alloc] initWithConversationChatter:conversationChatter conversationType:[self conversationTypeFromMessageType:messageType]];
 switch (messageType) {
 case EMChatTypeChat:
 {
 NSArray *groupArray = [[EMClient sharedClient].groupManager getJoinedGroups];
 for (EMGroup *group in groupArray) {
 if ([group.groupId isEqualToString:conversationChatter]) {
 //                                            chatViewController.title = group.subject;
 break;
 }
 }
 }
 break;
 default:
 //                                chatViewController.title = conversationChatter;
 break;
 }
 chatViewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:nil action:nil];
 [self.navigationController pushViewController:chatViewController animated:NO];
 }
 *stop= YES;
 }
 }
 else
 {
 ChatViewController *chatViewController = (ChatViewController *)obj;
 NSString *conversationChatter = userInfo[kConversationChatter];
 EMChatType messageType = [userInfo[kMessageType] intValue];
 chatViewController = [[ChatViewController alloc] initWithConversationChatter:conversationChatter conversationType:[self conversationTypeFromMessageType:messageType]];
 switch (messageType) {
 case EMChatTypeGroupChat:
 {
 NSArray *groupArray = [[EMClient sharedClient].groupManager getJoinedGroups];
 for (EMGroup *group in groupArray) {
 if ([group.groupId isEqualToString:conversationChatter]) {
 //                                chatViewController.title = group.subject;
 break;
 }
 }
 }
 break;
 default:
 //                        chatViewController.title = conversationChatter;
 break;
 }
 chatViewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:nil action:nil];
 [self.navigationController pushViewController:chatViewController animated:NO];
 }
 }];
 }
 else if (_chatListVC)
 {
 [self.navigationController popToViewController:self animated:NO];
 [self setSelectedViewController:_chatListVC];
 }
 }
 */
